package com.wqtz.chechai.adapter;

import android.view.View;

import com.wqtz.chechai.R;
import com.wqtz.chechai.base.lvbaseadapter.LvBaseAdapter;
import com.wqtz.chechai.base.lvbaseadapter.ViewHolder;
import com.wqtz.chechai.bean.CarTime;

import java.util.List;

/**
 * 项目名称： CheChai
 * 创建人 : Liberation
 * 创建时间: 2016/12/29 14:36
 */

public class CarRentTimeAdapter extends LvBaseAdapter<CarTime> {
	public CarRentTimeAdapter(int resId) {
		super(resId);
	}
	itemClick mItemClick;
	public void setOnItemClick(itemClick callback){
		mItemClick = callback;
	}

	@Override
	public void bindDatas(List<CarTime> list, final int position, ViewHolder holder) {
		if(list.get(position).days==30){
			holder.setText(R.id.content1,"一个月");
		}else {
			holder.setText(R.id.content1,list.get(position).days+"天");
		}
		holder.setText(R.id.content2,"利率"+list.get(position).count+"%");
		holder.getViewHolder().setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				mItemClick.onitemClickCallBack(position);

			}
		});
		holder.getView(R.id.iv).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				mItemClick.imageClickCallBack(position);
			}
		});

	}
	public interface itemClick{
		void onitemClickCallBack(int position);
		void imageClickCallBack(int position);
	}

}
